<%@ page language="java" %>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 
<%@ taglib uri="/WEB-INF/webflow.tld" prefix="webflow" %>
<%@ taglib uri="/WEB-INF/webform.tld" prefix="webform" %>

<%@page import="com.broadvision.ssp.webflow.*" %>
<%@page import="com.broadvision.ssp.webflow.WebflowHelper" %>
<%@page import="com.broadvision.ssp.common.SSContext" %>

<html>
<head>
	<title><bean:message bundle="appCommonRes" key="dr.listUser.title"/></title>
</head>

<body>

<script language="JavaScript">

var win;
var rewriteURL = '<html:rewrite page='<%= "/listUser.do" %>'/>';

function findUserPopup(popupURL) {

  win = window.open(popupURL, "SelectParticipants" , 'width=700,height=400,scrollbars=yes,resizable=yes');
  if ( win != null) {
    if( win.opener == null) {
      win.opener = self;
    }
  }
  win.focus();
}

function clearAdmin() {
   window.document.form1.assignee.options.length = 0;
}

function setAdmin(id, name,i) {
  if ( document.form1.assignee.options[i] != null ) {
     document.form1.assignee.options[i].selected=true;
     document.form1.assignee.options[i].value=id;
     document.form1.assignee.options[i].text=name;
   } else {
     document.form1.assignee.options[i] = new Option(name,id);
     document.form1.assignee.options[i].selected=true;
  }
}

function reviewersCheck() {
  if (window.document.form1.assignee.options.length == 0) {
    alert ('<bean:message bundle="appCommonRes" key="dr.error.pickReviewer" />');
    return false;
  }
  else
    return true;
}

</script>

<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="100%">
<div class="app_pageTitle"><bean:message bundle="appCommonRes" key="dr.listUser.title"/></div> 

<jsp:useBean id="uploadView" scope="request" type="com.broadvision.web.util.ViewDynaBean"/> 
<bean:define id="doc0" name="uploadView" property="documentList[0]" />
<bean:define id="docType" name="doc0" property="docType" />
	
<!-- review is file document -->
<logic:equal name="docType" value="0">
<jsp:include page="fileList.jsp" flush="true" />
</logic:equal>

<!-- review is microsite document -->
<logic:equal name="docType" value="2">
<jsp:include page="../../ep/microsite/msDocList.jsp" flush="true" />
</logic:equal>

<div class="app_pageSubtitle">
  <span class="left"><bean:message bundle="appCommonRes" key="dr.reviewers"/></span>
  <span class="right">&nbsp;</span>
</div>

<div class="blockWrap">
<webflow:encode url="/listUser.do" id="popupURL" />
<webflow:encode url="/pickReviewer.do" id="submitURL"/>
<%String url = (String)pageContext.getAttribute("submitURL");%>
<%String popup = (String)pageContext.getAttribute("popupURL");%>
<form name="form1" method="post" action="<html:rewrite page='<%=url%>'/>" onSubmit="return reviewersCheck()">
<webform:hidden url="<%=url%>" />
	
<table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<bean:message bundle="appCommonRes" key="dr.listUser.title"/>">
<tr>
<td class="label" valign="top" width="10%"><b><bean:message bundle="appCommonRes" key="dr.reviewers"/>:</b></td>
<td class="labelField" width="5%">
<select name="assignee" MULTIPLE size="5">
</select>
</td>
<td valign="top" class="label" width="85%"><input class="inputButton" type="button" value="<bean:message bundle="appCommonRes" key="dr.findReviewers"/>" onClick="findUserPopup('<html:rewrite page='<%=popup%>'/>')"></td>
</tr>
</table>

<div class="pageButtonWrap" align="right">
<input hspace="40" type="submit" name="action" class="pageButton" value="<bean:message bundle="appCommonRes" key="dr.submit"/>">
</div>

</div>
</form>

</td>
</tr>
</table>

</body>
</html>
